import http from '@/utils/http';

export default {
  namespaced: true,
  state: {
    operateList: [],
  },
  mutations: {
    getHomeOperate(state, data) {
      const s = state;
      s.operateList = data;
    },
  },
  actions: {
    async setOperateList({ commit }, str) {
      const result = await http.get(`/v1/apps?${str}`);
      if (!result) {
        return;
      }
      commit('getHomeOperate', result.data);
    },
    // add/update
    save(context, data) {
      return http.post(`/v1/app/save?${data}`);
    },
    // 用户注册POST /v1/app/config/modify
    modify(context, data) {
      return http.post(`/v1/app/config/modify?${data}`);
    },
  },
};
